1 : <?php
2 : /*
3 : ThWboard - PHP/MySQL Bulletin Board System
4 : ==============================================
5 : (c) 2000, 2001 by
6 : Paul Baecher <paul@thewall.de>
7 : Felix Gonschorek <funner@thewall.de>
8 :
9 : download the latest version:
10 : http://www.thwboard.de
11 :
12 : This program is free software; you can
13 : redistribute it and/or modify it under the
14 : terms of the GNU General Public License as
15 : published by the Free Software Foundation;
16 : either version 2 of the License, or (at
17 : your option) any later version.
18 :
19 : ==============================================
20 :
21 : */
22 : /*--------------------------------------------------------------------------+
23 : This file is part of eStudy.
24 : forum/admin/classes/class.adminfunctions.inc.php
25 : - Modulgruppe: Forum
26 : - Beschreibung: Funktionen für Administrative Forenscripte
27 : - Version: 02/26/04
28 : - Autor(en): Björn Lehnhardt, Benjamin Stadin <stadin@gmx.de>
29 : +---------------------------------------------------------------------------+
30 : This program is free software; you can redistribute it and/or
31 : modify it under the terms of the GNU General Public License
32 : as published by the Free Software Foundation; either version 2
33 : of the License, or any later version.
34 : +---------------------------------------------------------------------------+
35 : This program is distributed in the hope that it will be useful,
36 : but WITHOUT ANY WARRANTY; without even the implied warranty of
37 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 : GNU General Public License for more details.
39 : You should have received a copy of the GNU General Public License
40 : along with this program; if not, write to the Free Software
41 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 : +--------------------------------------------------------------------------*/
43 : /**
44 : * In dieser Datei sind Funktionen, die nur für Administrative Skripte benötigt werden
45 : * @package eStudy.PhotoGallery
46 : * @author Björn Lehnhardt <beini@gmx.de>
47 : * @author Benjamin Stadin <stadin@gmx.de>
48 : * @version 1.0, 02/26/04
49 : */
50 : function r_stripslashes(&$array) {
51 1 : while (list($k, $v) = each($array)) {
52 1 : if ($k != 'argc' && $k != 'argv' && (strtoupper($k) != $k || ''.intval($k) == "$k")) {
53 1 : if (is_string($v)) {
54 1 : $array[$k] = stripslashes($v);
55 1 : }
56 1 : if (is_array($v)) {
57 1 : $array[$k] = r_stripslashes($v);
58 1 : }
59 1 : }
60 1 : }
61 1 : return $array;
62 : }
63 :
64 :
65 : /// SQL-Query Ausführung
66 : /** Ausführung eines beliebigen SQL-Query
67 : *
68 : * @param $query - SQL-Query
69 : * @return Ergebniss der Anfrage
70 : */
71 : function query($query) {
72 3 : $result = mysql_query($query);
73 3 : $rows = mysql_affected_rows();
74 3 : $error = mysql_error();
75 3 : if ($error) {
76 0 : print "\n<span style='color: #FF0000;'><strong>MySQL: $error</strong></span><br/>";
77 0 : print "<pre><strong>query:</strong> $query\n\nAffected Rows: $rows</pre>";
78 0 : exit;
79 : }
80 3 : return $result;
81 : }
82 : // Da das Forum Templates verwendet kann die message und errormessage Anzeige des Frameworks nicht einfachgenommen werden
83 : function message($title, $msg, $opt_back = 1, $opt_index = 1) {
84 0 : global $settings;
85 0 : echo "<div class='center'><br/><br/><table>";
86 0 : output::echoMessage($msg, 2);
87 0 : echo "</table><br/><br/></div>";
88 0 : include_once PATH_TO_ROOT."forum/footer.inc.php";
89 : /** HTML-Fuss und unteres Menue */
90 0 : require_once (PATH_TO_ROOT."common/footer.inc.php");
91 0 : exit;
92 : }
93 : function errormessage($title = '', $msg, $opt_back = 1, $opt_index = 1) {
94 0 : global $settings;
95 0 : echo "<div class='center'><br/><br/><table>";
96 0 : output::errorMessage($msg);
97 0 : echo "</table><br/><br/></div>";
98 0 : include_once PATH_TO_ROOT."forum/footer.inc.php";
99 : /** HTML-Fuss und unteres Menue */
100 0 : require_once (PATH_TO_ROOT."common/footer.inc.php");
101 0 : exit;
102 : }
103 :
104 :
105 : function forum_query($query) {
106 1 : $result = mysql_query($query);
107 1 : if (mysql_errno()) {
108 1 : echo "Modul Forum (class.functions.inc.php): Fataler Fehler bei SQL Abfrage aufgetreten!";
109 : // echo $query;
110 1 : } else {
111 1 : return $result;;
112 : }
113 1 : }
114 :
115 :
116 : /// Verfügbare Templates
117 : /**
118 : * Dies Funktion durchsucht das Verzeichniss /potogallery/templates nach verfügbaren HTML-Templates
119 : * Die verfügbaren Templates werden in einem array gelistet;
120 : * @return array mit verfügbaren Templates
121 : */
122 : function get_templatesetarray() {
123 1 : $a_templateset = array();
124 1 : $dp = opendir('../templates/');
125 1 : while ($file = readdir($dp)) {
126 1 : if ($file != '.' && $file != '..' && $file != 'mail' && $file != 'CVS') {
127 1 : if (is_dir('../templates/'.$file)) {
128 1 : $a_templateset[] = $file;
129 1 : }
130 1 : }
131 1 : }
132 1 : return $a_templateset;
133 : }
134 :
135 : /// Yes / No Radio Button
136 : /** Diese Function erstellt einen Radiobutton
137 : *
138 : * @param $name - Bezeichnung
139 : * @param $yesno - default einstellung
140 : * @return Radio Button
141 : */
142 : function yesnoradio($name, $yesno = 0) {
143 1 : return '<p class="pForm"><input type="radio" name="'.$name.'" value="1"'.($yesno == 1 ? ' checked' : '') .'/></p>
144 : Ja
145 1 : <p class="pForm"><input type="radio" name="'.$name.'" value="0"'.($yesno == 0 ? ' checked' : '') .'/></p>
146 : Nein
147 1 : ';
148 : }
149 :
150 :
151 : /// Ausgabe eines Datum
152 : /**Ausgabe eins Gewünschten Datums in einr Box
153 : *
154 : * @param $name - Bezeichnung
155 : * @param $timestamp - Datum im Timestamp-Format
156 : * @return unknown_type
157 : */
158 : function datebox($name, $timestamp) {
159 1 : $date = getdate($timestamp);
160 1 : echo "<p class='pForm'><input type=\"text\" name=\"".$name."[mday]\" size=\"2\" maxlength=\"2\" value=\"$date[mday]\"/></p>
161 : .
162 1 : <p class='pForm'><input type=\"text\" name=\"".$name."[mon]\" size=\"2\" maxlength=\"2\" value=\"$date[mon]\"/></p>
163 : .
164 1 : <p class='pForm'><input type=\"text\" name=\"".$name."[year]\" size=\"4\" maxlength=\"4\" value=\"$date[year]\"/></p>
165 : ,
166 1 : <p class='pForm'><input type=\"text\" name=\"".$name."[hours]\" size=\"2\" maxlength=\"2\" value=\"$date[hours]\"/></p>
167 : :
168 1 : <p class='pForm'><input type=\"text\" name=\"".$name."[minutes]\" size=\"2\" maxlength=\"2\" value=\"$date[minutes]\"/></p>
169 1 : (dd.mm.yyyy, hh:mm)";
170 1 : }
171 :
172 :
173 : function genericformheader($action) {
174 1 : echo '<form id="form" method="post" action="'.$action.'">
175 : <table width="100%" cellspacing="0" cellpadding="3">
176 1 : ';
177 1 : }
178 : function genericformfooter() {
179 : echo ' <tr>
180 : <td> </td>
181 : <td>
182 : <p class="pForm"><input type="submit" name="Abschicken" value="Submit"/></p>
183 : </td>
184 : </tr>
185 : </table>
186 1 : </form>';
187 1 : }
188 : function genericformrow($desc, $name, $value = "", $size = "", $maxlength = "") {
189 1 : echo '<tr><td>'.$desc.'</td><td>';
190 1 : editbox($name, $value, $size, $maxlength);
191 1 : echo '</td></tr>';
192 1 : }
193 : function hidden($name, $value) {
194 1 : echo "<p class='pForm'><input type=\"hidden\" name=\"$name\" value=\"$value\"/></p>";
195 1 : }
196 : function editbox($name, $value = "", $size = "", $maxlength = "") {
197 2 : $editbox = "<p class='pForm'><input class=\"tbinput\" type=\"text\" name=\"$name\"";
198 2 : if ($size) {
199 1 : $editbox.= " size=\"$size\"";
200 1 : }
201 2 : if ($maxlength) {
202 1 : $editbox.= " maxlength=\"$maxlength\"";
203 1 : }
204 2 : if ($value) {
205 1 : $editbox.= " value=\"$value\"";
206 1 : }
207 2 : $editbox.= " /></p>";
208 2 : print $editbox;
209 2 : }
210 : function listbox($name, $key, $value, $table, $initial_select = -1, $additional = '') {
211 1 : print "\n\n<!-- listbox created by listbox() -->\n";
212 1 : print "<p class='pForm'><select class=\"tbinput\" name=\"$name\">\n$additional";
213 1 : $result = query("SELECT $key, $value FROM $table");
214 1 : while (list($key, $value) = mysql_fetch_row($result)) {
215 1 : print " <option value=\"$key\"".($key == $initial_select ? " selected='selected'" : "") .">$value</option>\n";
216 1 : }
217 1 : print "</select></p>\n";
218 1 : print "<!-- -->\n\n";
219 1 : }
220 :
221 :
222 :
223 : /// Datum Formatierung
224 : /** Formatiert einen "Datum-String" der From "yyyy.mm.dd hh.mm.ss" in die Form "dd.mm.yyyy".
225 : * Die Zeitangabe wird dabei weggelassen
226 : *
227 : * @param $string_date - Datum im Format "yyyy.mm.dd hh.mm.ss"
228 : * @return Datum-String - im Format "dd.mm.yyyy"
229 : */
230 : function format_db_date($string_date) {
231 1 : if ($string_date == '') {
232 1 : $output = "<strong>Error :</strong> Bad Time String !";
233 1 : } else {
234 1 : $output = substr($string_date, 8, 2) .".".substr($string_date, 5, 2) .".".substr($string_date, 0, 4);
235 : }
236 1 : return $output;
237 : }
238 : /*
239 : returns a string for use in <select> containing all categories and boards, ordered correctly
240 : */
241 : function get_ordered_board_list() {
242 1 : $s = '';
243 1 : $a_board = array();
244 1 : $r_board = query("SELECT boardid, boardname, categoryid FROM forum_board WHERE is_photogallery=1 ORDER BY boardorder ASC");
245 1 : while ($board = mysql_fetch_array($r_board)) {
246 1 : $a_board[$board['categoryid']][] = $board;
247 1 : }
248 1 : $r_category = query("SELECT categoryid, categoryname FROM forum_category ORDER BY categoryorder ASC");
249 1 : while ($category = mysql_fetch_array($r_category)) {
250 1 : if ($a_board[$category['categoryid']]) {
251 1 : $s.= '<option value="0">'.$category['categoryname'].'</option>';
252 1 : while (list(, $board) = each($a_board[$category['categoryid']])) {
253 1 : $s.= '<option value="'.$board['boardid'].'"> -- '.$board['boardname'].'</option>';
254 1 : }
255 1 : }
256 1 : }
257 1 : return $s;
258 : }
259 : function updateboard($boardid) {
260 : // updates last posttime/thread/author of a board ..
261 0 : $r_thread = query("SELECT threadid, threadtopic, threadtime, threadlastreplyby, COUNT(threadid) AS threadcount, SUM(threadreplies) AS postcount FROM forum_thread WHERE threadlink='0' AND boardid='".intval($boardid) ."' GROUP BY threadid ORDER BY threadtime DESC LIMIT 1");
262 0 : if (mysql_num_rows($r_thread) < 1) {
263 0 : query("UPDATE forum_board SET
264 : boardlastpost='0',
265 : boardthreadid='0',
266 : boardthreadtopic='',
267 : boardlastpostby='',
268 : boardposts='0',
269 : boardthreads='0'
270 0 : WHERE boardid='".intval($boardid) ."' AND is_photogallery=1");
271 0 : } else {
272 0 : $thread = mysql_fetch_array($r_thread);
273 0 : $thread['postcount']+= $thread['threadcount']; // threads without replies.
274 0 : query("UPDATE forum_board SET
275 0 : boardlastpost='$thread[threadtime]',
276 0 : boardthreadid='$thread[threadid]',
277 0 : boardthreadtopic='".addslashes($thread['threadtopic']) ."',
278 0 : boardlastpostby='".addslashes($thread['threadlastreplyby']) ."',
279 0 : boardposts='".addslashes($thread['postcount']) ."',
280 0 : boardthreads='".addslashes($thread['threadcount']) ."'
281 0 : WHERE boardid='".intval($boardid) ."' AND is_photogallery=1");
282 : }
283 0 : updateboard($boardid);
284 0 : }
285 : /**
286 : *
287 : * @param array $board - board mit verschiedene Eigenschaften
288 : * @param string $action - was soll gemacht werden
289 : * @param integer $admin - User Gruppe
290 : * @param string $method - GET oder POST
291 : * @param string $destination -Empfänger Skript
292 : *
293 : */
294 : class BoardForm {
295 : function CreateForm($board, $boardrights, $action, $admin, $method, $destination, $photo_view = true, $photo_upload = true, $photo_edit = true, $photo_remove = false) {
296 1 : print '<br/><form method="'.$method.'" action="'.$destination.'">
297 : <table width="100%" cellspacing="2" cellpadding="3">
298 : <tr class="tableCell">
299 : <td>Name des Albums:</td>
300 1 : <td> <p class="pForm"><input size="60" type="text" name="boardname" value="'.(isset($board['boardname']) ? Data::toHTML($board['boardname'], false) : '') .'"/></p> </td>
301 : </tr>
302 : <tr class="tableCell">
303 : <td>Beschreibung:</td>
304 1 : <td> <p class="pForm"><textarea class="mceEditor" id="mce" rows="10" cols="60" name="description">'.(isset($board['boarddescription']) ? Data::toHTML($board['boarddescription'], false) : '') .'</textarea></p> </td>
305 1 : </tr>';
306 : /*if (($admin==1) && ($action=="newboard")) {
307 : print'
308 : <tr class="tableCell">
309 : <td>Veranstaltung</td>
310 : <td>';
311 : listbox("course_id", "categoryid", "categoryname", "forum_category", $board['categoryid']);
312 : print '</td>
313 : </tr>';
314 : }*/
315 : print '
316 : <tr class="tableCell">
317 : <td>Status<br/>
318 : Geöffnet / Geschlossen
319 : </td>
320 : <td>
321 1 : <p class="pForm"><select class="tbinput" name="en"><option value="1" '.(isset($board['boarddisabled']) && $board['boarddisabled'] == 1 ? "selected='selected'" : "") .'>Geschlossen</option><option value="0" '.(!isset($board['boarddisabled']) || $board['boarddisabled'] == 0 ? " selected='selected'" : "") .'>Geöffnet</option></select></p>
322 : </td>
323 : </tr>
324 :
325 : <tr class="tableCell">
326 : <td>Bewertung</td>
327 : <td>
328 1 : <p class="pForm"><select class="tbinput" name="marking"><option value="1" '.(isset($board['marking']) && $board['marking'] == 1 ? "selected='selected'" : "") .'>aktiviert</option><option value="0" '.(!isset($board['marking']) || $board['marking'] == 0 ? " selected='selected'" : "") .'>deaktiviert</option></select></p>
329 : </td>
330 1 : </tr>';
331 1 : if ($_SESSION['course']!=0)
332 1 : {
333 : print '<tr class="tableCell">
334 : <td> Automatisches Abo </td>
335 : <td>
336 1 : <p class="pForm"><input type="checkbox" name="mustsee" '.(isset($board['mustsee']) && $board['mustsee'] == 1 ? "checked='checked'" : "") .'/></p>
337 : (Obligatorisches Abo für alle Kursmitglieder)
338 : </td>
339 1 : </tr>';
340 1 : }
341 : print '<tr class="tableCellDark">
342 : <td colspan="2" align="center"> <p style="width:66.6%;"><strong>Allgemeine Rechte für dieses Album</strong><br/>Dozenten und Tutoren haben alle Rechte. Rechte für bestimmte Studenten können nach der Erstellung des Albums festgelegt werden.</p></td>
343 : </tr>
344 :
345 : <tr class="tableCell">
346 : <td> Kann Album einsehen</td>
347 1 : <td> <p class="pForm"><input type="checkbox" name="photo_view" '.($photo_view == '1' ? "checked='checked'" : "") .'/></p> </td>
348 : </tr>
349 :
350 :
351 : <tr class="tableCell">
352 : <td> Kann neue Bilder einstellen </td>
353 1 : <td> <p class="pForm"><input type="checkbox" name="photo_upload" '.($photo_upload == 1 ? "checked='checked'" : "") .'/></p> </td>
354 : </tr>
355 :
356 : <tr class="tableCell">
357 : <td> Kann Kommentare abgeben </td>
358 1 : <td> <p class="pForm"><input type="checkbox" name="II" '.($boardrights[1] == 1 ? "checked='checked'" : "") .'/></p> </td>
359 : </tr>
360 :
361 : <tr class="tableCell">
362 : <td> Kann selbst erstellte Bilder löschen </td>
363 1 : <td> <p class="pForm"><input type="checkbox" name="photo_remove" '.($photo_remove == 1 ? "checked='checked'" : "") .'/></p> </td>
364 : </tr>
365 :
366 :
367 : <tr class="tableCell">
368 : <td> Kann selbst erstellte Kommentare löschen </td>
369 1 : <td> <p class="pForm"><input type="checkbox" name="VII" '.($boardrights[6] == 1 ? "checked='checked'" : "") .'/></p> </td>
370 : </tr>
371 :
372 : <tr class="tableCell">
373 : <td> Kann selbst erstellte Bilder bearbeiten </td>
374 1 : <td> <p class="pForm"><input type="checkbox" name="photo_edit" '.($photo_edit == 1 ? "checked='checked'" : "") .'/></p> </td>
375 : </tr>
376 :
377 : <tr class="tableCell">
378 : <td> Kann selbst erstellte Kommentare bearbeiten </td>
379 1 : <td> <p class="pForm"><input type="checkbox" name="VIII" '.($boardrights[7] == 1 ? "checked='checked'" : "") .'/></p> </td>
380 : </tr>
381 :
382 :
383 :
384 : <tr class="tableCellDark">
385 1 : <td colspan="2" align="center">';
386 1 : if ($admin != 1) {
387 : print '
388 1 : <p class="pForm"><input type="hidden" name="course_id" value="'.$_SESSION['course'].'"/></p>';
389 1 : }
390 1 : if ($action == "edit") {
391 : print '
392 : <p class="pForm"><input type="hidden" name="update" value="1"/></p>
393 1 : <p class="pForm"><input type="hidden" name="id" value="'.$board['boardid'].'"/></p>';
394 1 : }
395 : print '
396 1 : <p class="pForm"><input type="hidden" name="action" value="'.$action.'"/></p>
397 : <p class="pForm"><input type="submit" name="Send" value="Bestätigen"/></p>
398 : </td>
399 : </tr>
400 : </table>
401 1 : </form>';
402 1 : }
403 : }
404 : /**
405 : * Diese Funktion setzt Zugriffsrechte auf Boards.
406 : *
407 : * @param integer $courseID - ID des Kurses
408 : * @param integer $boardID - ID Des Boards
409 : * @param boolean $moderatorsOnly - Board soll nur für Moderatoren (Admins, Dozenten, Tutoren und Hilfsadmins) zugänglich sein?
410 : *
411 : */
412 : function addBoardRights($courseID, $boardID, $accessMask, $photo_view, $photo_upload, $photo_edit, $photo_remove) {
413 : // Eine neue Kategorie für die Veranstaltung im Forum anlegen
414 0 : global $db, $EZSQL_ERROR, $settings;
415 0 : if (is_numeric($courseID)) {
416 0 : $courseID = (int)$courseID;
417 0 : $moderatorGroupID = $db->get_row("SELECT groupid FROM {$settings['dbPrefix']}forum_group WHERE name='".$courseID."_moderators'");
418 0 : $studentGroupID = $db->get_row("SELECT groupid FROM {$settings['dbPrefix']}forum_group WHERE name='".$courseID."_students'");
419 0 : $guestGroupID = $db->get_row("SELECT groupid FROM {$settings['dbPrefix']}forum_group WHERE name='".$courseID."_guests'");
420 : // Wärend die 2 globalen Gruppen in forum_board Rechte für das gesamte Forum betreffen (sind auf null gesetzt),
421 : // betreffen die Rechte in forum_groupboard nur Einzelne Boards und deren Gruppenmitglieder
422 : // Gruppenrechte dieses Boards für Studenten
423 0 : $sql = ("INSERT INTO {$settings['dbPrefix']}forum_groupboard( boardid,accessmask,groupid )
424 0 : VALUES($boardID,
425 0 : '$accessMask',
426 0 : ".$studentGroupID->groupid.")");
427 0 : $db->query($sql);
428 : // Gruppenrechte dieses Boards für Gäste
429 0 : $sql = ("INSERT INTO {$settings['dbPrefix']}forum_groupboard( boardid,accessmask,groupid )
430 0 : VALUES($boardID,
431 0 : '$accessMask',
432 0 : ".$guestGroupID->groupid.")");
433 0 : $db->query($sql);
434 : // Gruppenrechte dieses Boards für Moderatoren, war 111101011000100001
435 0 : $sql = ("INSERT INTO {$settings['dbPrefix']}forum_groupboard( boardid,accessmask,groupid )
436 0 : VALUES($boardID,
437 : '111111111111111111',
438 0 : ".$moderatorGroupID->groupid.")");
439 0 : $db->query($sql);
440 : //photogallery rechte
441 0 : $sql = "INSERT INTO {$settings['dbPrefix']}photogallery_rights( course_id,album_id,usr_id,view,upload,edit,remove) VALUES("."$courseID,$boardID,0".",$photo_view,$photo_upload,$photo_edit,$photo_remove)";
442 0 : $db->query($sql);
443 0 : }
444 0 : return true;
445 : }
446 : function updateBoardRights($boardID, $accessMask, $photo_view, $photo_upload, $photo_edit, $photo_remove) {
447 : // Eine neue Kategorie für die Veranstaltung im Forum anlegen
448 0 : global $db, $EZSQL_ERROR, $settings;
449 0 : if (is_numeric($boardID)) if ($select = $db->get_row("SELECT categoryid FROM {$settings['dbPrefix']}forum_board WHERE boardid=$boardID AND is_photogallery=1 LIMIT 1")) {
450 0 : $db->query("DELETE FROM {$settings['dbPrefix']}forum_groupboard WHERE boardid=$boardID LIMIT 1");
451 0 : $db->query("DELETE FROM {$settings['dbPrefix']}photogallery_rights WHERE album_id=$boardID AND usr_id='0' LIMIT 1");
452 0 : addBoardRights($select->categoryid, $boardID, $accessMask, $photo_view, $photo_upload, $photo_edit, $photo_remove);
453 0 : }
454 0 : return true;
455 : }
456 : // Aus Sicherheitsgründen verzichte ich darauf die Klasse forum/classes/class.funcions.inc.php einzubinden für Admin Skripte
457 : // Stattdessen finden sich hier einige wenige beötigte Funktionen wieder
458 : function compress_page($output) {
459 0 : global $_SERVER, $config;
460 0 : if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzcompress') && $config['compression']) {
461 0 : $output.= '<!-- gzcompress()ed -->';
462 : // http://www.p hp.net/manual/en/function.gzcompress.p hp -- comments
463 0 : header('Content-Encoding: gzip');
464 0 : $size = strlen($output);
465 0 : $crc = crc32($output);
466 0 : $output = gzcompress($output, 1);
467 0 : print "\x1f\x8b\x08\x00\x00\x00\x00\x00";
468 0 : print substr($output, 0, strlen($output) -4);
469 0 : print pack('V', $crc);
470 0 : print pack('V', $size);
471 0 : } else {
472 0 : print $output;
473 : }
474 0 : }
475 : function build_link($link, $noamp = false) {
476 0 : global $g_user, $s;
477 0 : $add = '';
478 0 : if ($g_user['userID'] != 0) {
479 0 : if ($x = strpos($link, "#")) {
480 0 : $link = substr($link, 0, $x) .$add.substr($link, $x);
481 0 : } else {
482 0 : $link.= $add;
483 : }
484 0 : }
485 0 : return $link;
486 : }
487 : class Template {
488 : function Template($szTemplateName) {
489 2 : if (!file_exists($szTemplateName)) {
490 0 : $this->Halt("unable to load template file: '".$szTemplateName."' does not exist.");
491 0 : }
492 2 : $this->szTemplateData = @implode('', (@file($szTemplateName)));
493 2 : $this->szTemplateData = str_replace('"', '\"', $this->szTemplateData);
494 2 : $this->szTemplateData = preg_replace("/_\('([^']+)'\)/", '".build_link("$1")."', $this->szTemplateData);
495 2 : }
496 : function GetTemplate($szVarname = "") {
497 1 : if ($szVarname) {
498 1 : return ('$'.$szVarname.' .= "'.$this->szTemplateData.'";');
499 : } else {
500 1 : return ('compress_page("'.$this->szTemplateData.'");');
501 : }
502 : }
503 : function Halt($szErrorMsg) {
504 0 : echo "<pre>Template error:\n ".$szErrorMsg."</pre>";
505 0 : exit;
506 : }
507 : }
508 : function message_redirect($msg, $url) {
509 0 : global $settings;
510 0 : $TRedirect = new Template('../templates/redirect.html');
511 0 : eval($TRedirect->GetTemplate());
512 0 : include_once "../footer.inc.php";
513 : /** HTML-Fuss und unteres Menue */
514 0 : require_once (PATH_TO_ROOT."common/footer.inc.php");
515 0 : exit;
516 : }
|